// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SourceFile

package com.sgame.android.network;

import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
import org.json.JSONObject;

public class Credentials
    implements Parcelable, Serializable, Cloneable
{
    public static enum Field
    {
        OAUTH2_TOKEN, OAUTH_TOKEN, AUTH_TOKEN, OAUTH_SECRET
    }


    public Credentials(JSONObject object)
    {
        consumerKey = null;
        consumerSecret = null;
        auth_token = "";
        oauth_token = "";
        oauth_tokenSecret = "";
        tokenv2 = null;
        setFromJSON(object);
    }

    public void setFromJSON(JSONObject object)
    {
        setOAuth2Token(object.optString(Field.OAUTH2_TOKEN.name()));
        setOAuthToken(object.optString(Field.OAUTH_TOKEN.name()));
        setAuth_token(object.optString(Field.AUTH_TOKEN.name()));
        setOAuthTokenSecret(object.optString(Field.OAUTH_SECRET.name()));
        object.optJSONObject("profile");
    }

    public Credentials(Parcel in)
    {
        consumerKey = null;
        consumerSecret = null;
        auth_token = "";
        oauth_token = "";
        oauth_tokenSecret = "";
        tokenv2 = null;
        consumerKey = in.readString();
        consumerSecret = in.readString();
        auth_token = in.readString();
        oauth_token = in.readString();
        oauth_tokenSecret = in.readString();
        if(in.dataAvail() > 0)
            tokenv2 = in.readString();
    }

    public Credentials()
    {
        consumerKey = null;
        consumerSecret = null;
        auth_token = "";
        oauth_token = "";
        oauth_tokenSecret = "";
        tokenv2 = null;
    }

    public String getConsumerKey()
    {
        return consumerKey;
    }

    public void setConsumerKey(String consumerKey)
    {
        this.consumerKey = consumerKey;
    }

    public String getConsumerSecret()
    {
        return consumerSecret;
    }

    public void setConsumerSecret(String consumerSecret)
    {
        this.consumerSecret = consumerSecret;
    }

    public boolean hasOAuthToken()
    {
        return getOAuthToken() != null && getOAuthToken().length() > 0;
    }

    public String getOAuthToken()
    {
        return oauth_token;
    }

    public void setOAuthToken(String token)
    {
        oauth_token = token;
    }

    public String getOAuthTokenSecret()
    {
        return oauth_tokenSecret;
    }

    public void setOAuthTokenSecret(String tokenSecret)
    {
        oauth_tokenSecret = tokenSecret;
    }

    public String getOAuth2Token()
    {
        return tokenv2;
    }

    public void setOAuth2Token(String tokenv2)
    {
        this.tokenv2 = tokenv2;
    }

    public boolean hasAuth_Token()
    {
        return getAuth_token() != null && getAuth_token().length() > 0;
    }

    public String getAuth_token()
    {
        return auth_token;
    }

    public void setAuth_token(String auth_token)
    {
        this.auth_token = auth_token;
    }

    public int describeContents()
    {
        return 0;
    }

    public Object clone()
    {
        try
        {
            return super.clone();
        }
        catch(CloneNotSupportedException clonenotsupportedexception)
        {
            throw new RuntimeException("Should not happen", clonenotsupportedexception);
        }
    }

    public void clearTokens()
    {
        setAuth_token("");
        setOAuth2Token("");
        setOAuthToken("");
        setOAuthTokenSecret("");
    }

    public void writeToParcel(Parcel dest, int i)
    {
        dest.writeString(consumerKey);
        dest.writeString(consumerSecret);
        dest.writeString(auth_token);
        dest.writeString(oauth_token);
        dest.writeString(oauth_tokenSecret);
        dest.writeString(tokenv2);
    }

    private static final long serialVersionUID = 1L;
    private String consumerKey;
    private String consumerSecret;
    private String auth_token;
    private String oauth_token;
    private String oauth_tokenSecret;
    private String tokenv2;
    public static final android.os.Parcelable.Creator CREATOR = new android.os.Parcelable.Creator() {

        public final Object[] newArray(int i)
        {
            return new Credentials[i];
        }

        public final Object createFromParcel(Parcel parcel)
        {
            return new Credentials(parcel);
        }

    }
;

}
